#ifndef KRIGING_MANAGEMENT_H
#define KRIGING_MANAGEMENT_H


#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <sys/time.h>
#include "kriging_aux.h"
#include "kriging_aux_kernels.h"
#include <cuda_runtime_api.h>
#include <cuda.h>
#include <iostream>
#include <fstream>
#include <string.h>
#include <boost/lexical_cast.hpp>

using namespace std;

class KrigingManagement
{
private:
    float *dataX;
    float *dataY;
    int *cor;
    int number_of_lines;
    int histogram_nbits;
    int nugget_effect;
    int reach;
    int landing;
    float *YSintetcSemvariogram;
    float *Histogram_Xaxis;
    int contribution;
    float *distance_to_from;
    float erro;
    float *covarianceMatrix;
    float * estimated_points;
    double tempo_semivariograma,tempo_covariancias,tempo_determinate,
            tempo_inversao,tempo_sintetico,tempo_estimacao_serial,tempo_estimacao_paralelo;

    void SemivariogramaExperimental();
    void calculateCovarianceMatrix();
    bool isCovarianceMatrixInversible();
    float *inverseCovarianceMatrix();
    void gravaNoArquivo(bool parallel);
    float *estimatedX,*estimatedY;
    void getResultMatrix(float *v, int t, int c, ofstream *matrix);
    void getExtimatedPoints(float * X, float * Y, int intervalos, float * estimated, ofstream *points);


public:
    KrigingManagement(float *dataX,
                      float *dataY,
                      int *cor,
                      int number_of_lines,
                      int histogram_nbits,
                      int erro);
    void SinteticSemivariogram(int landing, int reach, int nugget_effect);

    void SerialKriging();
    void ParallelKriging();
    void exibeTempos();


};



#endif // KRIGING_MANAGEMENT_H
